<template>
	<view>
		<dev-navbar :title="title"></dev-navbar>
		<view class="fu">
			<u-parse :html="explain"></u-parse>
		</view>
		<view class="loading-box" v-show="loadingone">
			<u-loading :show="loadingone" color="#41ADBA" size="70"></u-loading>
			<view class="loading-textsl">
				加载中
			</view>
		</view>
	</view>
</template>

<script>
	import uParse from "@/uview-ui/components/u-parse/u-parse.vue"
	import uLoading from "@/uview-ui/components/u-loading/u-loading.vue"
	export default {
		components: {
			uParse,
			uLoading
		},
		data() {
			return {
				title: '用户服务协议', //
				explain: '', //用户注册协议
				loadingone: false, //加载中
			};
		},
		onLoad(e) {
			if (e.type == 1) {
				this.title = '用户服务协议';
			}
			if (e.type == 2) {
				this.title = '隐私政策';
			}
			if (e.type == 3) {
				this.title = '关于我们';
			}
			if (e.type == 4) {
				this.title = '商家入驻协议';
			}
			this.getdata(e.type); //获取隐私协议
		},
		methods: {
			//获取注册协议数据
			getdata(type) {
				// useragger
				this.loadingone = true;
				this.$api.get(global.apiUrls.useragger, {
						position: 1, //1用户端 2门店端
						type: type, //协议类型1:用户服务协议,2:隐私政策条款,3:关于我们,4:商家入驻协议
					})
					.then(res => {
						// console.log(res.data.data)
						if (res.data.code == 1000) {
							this.explain = res.data.result[0].content;
							this.loadingone = false;
						} else {
							this.loadingone = false;
						}
					}).catch(err => {
						console.log(res)
						this.loadingone = false;
						// this.loginBtnLoading = false;
					})
			}
		}
	}
</script>

<style lang="scss">
	.fu {
		padding: 0upx 24upx;
	}
</style>
